varying highp vec2 RGBTexCoordVarying;
varying highp vec2 alphaTexCoordVarying;
precision mediump float;

uniform sampler2D SamplerY;
uniform sampler2D SamplerUV;
uniform mat3 colorConversionMatrix;

void main()
{
   mediump vec3 yuv_rgb;
   lowp vec3 rgb_rgb;

   mediump vec3 yuv_alpha;
   lowp vec3 rgb_alpha;

   // Subtract constants to map the video range start at 0
   yuv_rgb.x = (texture2D(SamplerY, RGBTexCoordVarying).r);// - (16.0/255.0));
   yuv_rgb.yz = (texture2D(SamplerUV, RGBTexCoordVarying).ra - vec2(0.5, 0.5));

   rgb_rgb = colorConversionMatrix * yuv_rgb;


   yuv_alpha.x = (texture2D(SamplerY, alphaTexCoordVarying).r);// - (16.0/255.0));
   yuv_alpha.yz = (texture2D(SamplerUV, alphaTexCoordVarying).ra - vec2(0.4, 0.4));

   rgb_alpha = colorConversionMatrix * yuv_alpha;


   gl_FragColor = vec4(rgb_rgb,rgb_alpha.r);
//        gl_FragColor = vec4(1, 0, 0, 1);
}
